home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / program / cgrphxdv.lha / CGraphX / Oberon / Interfaces / CyberGraphics.mod
Text File  |  1995-12-19  |  11KB  |  278 lines

  1. (*------------------------------------------
  2.  
  3.   :Module.      CyberGraphics.mod
  4.   :Author.      Mario Kemper  [mk]
  5.   :Address.     Geiststrasse 53 , D-59555 Lippstadt
  6.   :EMail.       magick@bundy.lip.owl.de
  7.   :EMail.       magick@uni-paderborn.de
  8.   :Phone.       02941/5509
  9.   :Revision.    R.3
  10.   :Date.        16-Dec-1995
  11.   :Copyright.   Mario Kemper
  12.   :Language.    Oberon-2
  13.   :Translator.  Oberon 3.20 (03.08.94)
  14.   :Contents.    Interface for the CyberGraphics.library
  15.   :Remarks.     Straight port from the c-includes
  16.   :History.     .0     [mk] 29-Nov-1995 : Initial release
  17.   :History.     .1     [mk] 09-Dec-1995 : dpmsON -> dpmsOn (Nils Knop)
  18.   :History.     .2     [mk] 13-Dec-1995 : added mAttrIsLinearMem
  19.   :History.     .3     [mk] 16-Dec-1995 : addes Tags for LockBitMapTagList()
  20.  
  21.  
  22. --------------------------------------------*)
  23.  
  24.  
  25.  
  26. MODULE CyberGraphics;
  27.  
  28. IMPORT int:=Intuition,u:=Utility,gfx:=Graphics,e:=Exec;
  29.  
  30. (*                                                          *)
  31. (*  Definition of CyberModeNode (Returned in AllocModeList) *)
  32. (*                                                          *)
  33.  
  34. TYPE
  35.   CyberModeNodePtr *= UNTRACED POINTER TO CyberModeNode;
  36.  
  37.   CyberModeNode    *=
  38.     STRUCT (node *: e.Node)
  39.       modeText       *: ARRAY  gfx.displayNameLen OF CHAR;
  40.       displayID      *: LONGINT;
  41.       width          *: INTEGER;
  42.       height         *: INTEGER;
  43.       depth          *: INTEGER;
  44.       displayTagList *: e.APTR;  (* taglist with extended ModeID information *)
  45.     END;
  46.  
  47. (*                                  *)
  48. (* Parameters for GetCyberMapAttr() *)
  49. (*                                  *)
  50.  
  51. CONST
  52.  
  53.   mAttrXMod        *= u.user + 1; (* function returns BytesPerRow if its called with this parameter *)
  54.   mAttrBPPix       *= u.user + 2; (* BytesPerPixel shall be returned *)
  55.   mAttrDispAdr     *= u.user + 3; (* do not use this ! private tag *)
  56.   mAttrPixFmt      *= u.user + 4; (* the pixel format is returned *)
  57.   mAttrWidth       *= u.user + 5; (* returns width in pixels *)
  58.   mAttrHeight      *= u.user + 6; (* returns height in lines *)
  59.   mAttrDepth       *= u.user + 7; (* returns bits per pixel *)
  60.   mAttrIsCyberGfx  *= u.user + 8; (* returns -1 if supplied bitmap is a cybergfx one *)
  61.   mAttrIsLinearMem *= u.user + 9; (* returns -1 if supplied bitmap is linear accessible *)
  62.  
  63. (*                                 *)
  64. (* Parameters for GetCyberidAttr() *)
  65. (*                                 *)
  66.  
  67.   idAttrPixFmt   *= u.user + 1; (* the pixel format is returned *)
  68.   idAttrWidth    *= u.user + 2; (* returns visible width in pixels *)
  69.   idAttrHeight   *= u.user + 3; (* returns visible height in lines *)
  70.   idAttrDepth    *= u.user + 4; (* returns bits per pixel *)
  71.   idAttrBPPix    *= u.user + 5; (* BytesPerPixel shall be returned *)
  72.  
  73. (*                              *)
  74. (* Tags for CyberModeRequest()  *)
  75. (*
  76.                               *)
  77.  
  78.   mReqTB         *= u.user + 40000H;
  79.  
  80. (*            *)
  81. (* FilterTags *)
  82. (*            *)
  83.  
  84.   mReqMinDepth    *= mReqTB+0;  (* Minimum depth for displayed screenmode *)
  85.   mReqMaxDepth    *= mReqTB+1;  (* Maximum depth  "       "        " *)
  86.   mReqMinWidth    *= mReqTB+2;  (* Minumum width  "       "        " *)
  87.   mReqMaxWidth    *= mReqTB+3;  (* Maximum width  "       "        " *)
  88.   mReqMinHeight   *= mReqTB+4;  (* Minumum height "       "        " *)
  89.   mReqMaxHeight   *= mReqTB+5;  (* Minumum height "       "        " *)
  90.   mReqCModelArray *= mReqTB+6;
  91.  
  92.   mReqWinTitle    *= mReqTB+20;
  93.   mReqOKText      *= mReqTB+21;
  94.   mReqCancelText  *= mReqTB+22;
  95.  
  96.   mReqScreen      *= mReqTB+30;  (* Screen you wish the Requester to open on *)
  97.  
  98. (*                            *)
  99. (* Tags for BestCyberModeID() *)
  100. (*                            *)
  101.  
  102.   bIDTGTB *= u.user+50000H;
  103.  
  104. (* FilterTags *)
  105.  
  106.   bIDTGDepth         *= bIDTGTB+0;
  107.   bIDTGNominalWidth  *= bIDTGTB+1;
  108.   bIDTGNominalHeight *= bIDTGTB+2;
  109.   bIDTGMonitorID     *= bIDTGTB+3;
  110.  
  111. (*                                    *)
  112. (* definition of divers pixel formats *)
  113. (*                                    *)
  114.  
  115.   pixFmtLUT8     *=  0;
  116.   pixFmtRGB15    *=  1;
  117.   pixFmtBGR15    *=  2;
  118.   pixFmtRGB15PC  *=  3;
  119.   pixFmtBGR15PC  *=  4;
  120.   pixFmtRGB16    *=  5;
  121.   pixFmtBGR16    *=  6;
  122.   pixFmtRGB16PC  *=  7;
  123.   pixFmtBGR16PC  *=  8;
  124.   pixFmtRGB24    *=  9;
  125.   pixFmtBGR24    *= 10;
  126.   pixFmtARGB32   *= 11;
  127.   pixFmtBGRA32   *= 12;
  128.   pixFmtRGBA32   *= 13;
  129.  
  130. (*                                                        *)
  131. (* SrcRectangle formats defines for xxxPixelArray calls() *)
  132. (*                                                        *)
  133.  
  134.    rectFmtRGB   *= 0;
  135.    rectFmtRGBA  *= 1;
  136.    rectFmtARGB  *= 2;
  137.    rectFmtLUT8  *= 3;
  138.    rectFmtGREY8 *= 4;
  139.  
  140. (*                                    *)
  141. (* Parameters for CVideoCtrlTagList() *)
  142. (*                                    *)
  143.  
  144.    setVCDPMSLevel *= 88002001H;
  145.  
  146.    dpmsOn       * = 0;   (* Full operation *)
  147.    dpmsStandby  * = 1;   (* Optional state of minimal power reduction *)
  148.    dpmsSuspend  * = 2;   (* Significant reduction of power consumption *)
  149.    dpmsOff      * = 3;   (* Lowest level of power consumption *)
  150.  
  151. (*                              *)
  152. (* Tags for LockBitMapTagList() *)
  153. (*                              *)
  154.  
  155.    bmiTB           *= u.user + 4001000H;
  156.  
  157.    bmiWidth        *= bmiTB + 1;
  158.    bmiHeight       *= bmiTB + 2;
  159.    bmiDepth        *= bmiTB + 3;
  160.    bmiPixFmt       *= bmiTB + 4;
  161.    bmiBytesPerPix  *= bmiTB + 5;
  162.    bmiBytesPerRow  *= bmiTB + 6;
  163.    bmiBaseAddress  *= bmiTB + 7;
  164.  
  165.  
  166.  
  167.    cgfxVersion *= 40;
  168.    cgfxName    *= "cybergraphics.library";
  169.  
  170. VAR
  171.  
  172.   cgfx * : e.APTR;
  173.  
  174. (**--- functions in V40 or higher (Release 40.40) ---*)
  175. PROCEDURE cgfxPrivate1          *{cgfx,- 30}; (*private*)
  176. PROCEDURE cgfxPrivate2          *{cgfx,- 36}; (*private*)
  177. PROCEDURE cgfxPrivate3          *{cgfx,- 42}; (*private*)
  178. PROCEDURE cgfxPrivate4          *{cgfx,- 48}; (*private*)
  179. PROCEDURE cgfxPrivate5          *{cgfx,- 84}; (*private*)
  180. PROCEDURE cgfxPrivate6          *{cgfx,-138}; (*private*)
  181.  
  182. PROCEDURE AllocCModeListTagList *{cgfx,- 72}(modeListTagList{9}   : ARRAY OF u.TagItem) : CyberModeNodePtr;
  183.  
  184.  
  185. PROCEDURE AllocCModeListTags    *{cgfx,- 72}(modeListTags{9}.. : u.Tag) : CyberModeNodePtr;
  186.  
  187. PROCEDURE BestCModeIDTagList    *{cgfx,- 60}(bestModeIDTagList{8} : ARRAY OF u.TagItem):LONGINT;
  188.  
  189. PROCEDURE BestCModeIDTags       *{cgfx,- 60}(bestModeIDTags{8}..  : u.Tag):LONGINT;
  190.  
  191. PROCEDURE CModeRequestTagList   *{cgfx,- 66}(modeRequest{8} : e.APTR;
  192.                                                      modeRequestTagList{9}  : ARRAY OF u.TagItem):LONGINT;
  193.  
  194. PROCEDURE CModeRequestTags      *{cgfx,- 66}(modeRequest{8}       : e.APTR;
  195.                                                      modeRequestTags{9}.. : u.Tag):LONGINT;
  196.  
  197. PROCEDURE CVideoCtrlTagList     *{cgfx,-162}(viewPort{8} : gfx.ViewPortPtr;
  198.                                                      tagList{9}  : ARRAY OF u.TagItem);
  199.  
  200. PROCEDURE CVideoCtrlTags        *{cgfx,-162}(viewPort{8} : gfx.ViewPortPtr;
  201.                                                      tags{9}..   : u.Tag);
  202.  
  203. PROCEDURE DoCDrawMethodTagList  *{cgfx,-156}(hook{8} : u.HookPtr;
  204.                                                      rastPort{9} :gfx.RastPortPtr;
  205.                                                      tagList{10} : ARRAY OF u.TagItem);
  206.  
  207. PROCEDURE DoCDrawMethodTags     *{cgfx,-156}(hook{8} : u.HookPtr;
  208.                                                      rastPort{9} :gfx.RastPortPtr;
  209.                                                      tags{10}.. : u.Tag);
  210.  
  211. PROCEDURE FillPixelArray        *{cgfx,-150}(rastPort{9} : gfx.RastPortPtr;
  212.                                                      destX{0},destY{1},sizeX{2},sizeY{3}:INTEGER;
  213.                                                      argb{4}:LONGINT):LONGINT;
  214.  
  215. PROCEDURE FreeCModeList         *{cgfx,- 78}(modeList{8} : CyberModeNodePtr);
  216.  
  217. PROCEDURE GetCyberIDAttr        *{cgfx,-102}(cyberIDAttr{0}:LONGINT;
  218.                                                      cyberDisplayModeID{1}:LONGINT):LONGINT;
  219.  
  220. PROCEDURE GetCyberMapAttr       *{cgfx,- 96}(cyberGfxBitmap{8}:gfx.BitMapPtr;
  221.                                                      cyberAttrTag{0}:LONGINT):LONGINT;
  222.  
  223. PROCEDURE InvertPixelArray      *{cgfx,-144}(rastPort{8}:gfx.RastPortPtr;
  224.                                                      destX{0},destY{1},sizeX{2},sizeY{3}:INTEGER):LONGINT;
  225.  
  226. PROCEDURE IsCyberModeID         *{cgfx,- 54}(displayID{0}:LONGINT):BOOLEAN;
  227.  
  228. PROCEDURE MovePixelArray        *{cgfx,-132}(srcX{0},srcY{1}:INTEGER;
  229.                                                      rastPort{9}:gfx.RastPortPtr;
  230.                                                      destX{2},destY{3},sizeX{4},sizeY{5}:INTEGER):LONGINT;
  231.  
  232. PROCEDURE ReadPixelArray        *{cgfx,-120}(destRect{8}:e.APTR;
  233.                                                      destX{0},destY{1},destMod{2}:INTEGER;
  234.                                                      rastPort{9}:gfx.RastPortPtr;
  235.                                                      srcX{3},srcY{4},sizeX{5},sizeY{6}:INTEGER;
  236.                                                      destFormat{7}:LONGINT):LONGINT;
  237.  
  238. PROCEDURE ReadRGBPixel          *{cgfx,-108}(rastPort{9}:gfx.RastPortPtr;
  239.                                                      x{0},y{1}:INTEGER):LONGINT;
  240.  
  241. PROCEDURE ScalePixelArray       *{cgfx,- 90}(srcRect{8}:e.APTR;
  242.                                                      srcW{0},srcH{1},srcMod{2}:INTEGER;
  243.                                                      rastPort{9}:gfx.RastPortPtr;
  244.                                                      destX{3},destY{4},destW{5},destH{6}:INTEGER;
  245.                                                      srcFormat{7}:LONGINT):LONGINT;
  246.  
  247. PROCEDURE WritePixelArray       *{cgfx,-126}(srcRect{8}:e.APTR;
  248.                                                      srcX{0},srcY{1},srcMod{2}:INTEGER;
  249.                                                      rastPort{9}:gfx.RastPortPtr;
  250.                                                      destX{3},destY{4},sizeX{5},sizeY{6}:INTEGER;
  251.                                                      srcFormat{7}:LONGINT):LONGINT;
  252.  
  253. PROCEDURE WriteRGBPixel         *{cgfx,-114}(rastPort{9}:gfx.RastPortPtr;
  254.                                                      x{0},y{1}:INTEGER;
  255.                                                      argb{2}:LONGINT):LONGINT;
  256.  
  257. (*--- functions in V40 or higher (Release 40.60) --- *)
  258. PROCEDURE LockBitMapTagList     *{cgfx,-168}(bitMap{8}:gfx.BitMapPtr;
  259.                                                      tagList{9} : ARRAY OF u.TagItem): e.APTR;
  260. PROCEDURE LockBitMapTags        *{cgfx,-168}(bitMap{8}:gfx.BitMapPtr;
  261.                                                      tags{9}.. : u.Tag) :e.APTR;
  262.  
  263.  
  264. PROCEDURE UnLockBitMap          *{cgfx,-174}(handle{8}:e.APTR);
  265.  
  266. BEGIN
  267.   cgfx := e.OpenLibrary(cgfxName,cgfxVersion);
  268.   IF cgfx = NIL THEN
  269.     IF int.DisplayAlert(0,"\x00\x64\x14missing cybergraphics.library\o\o",50) THEN END;
  270.     HALT(20)
  271.   END;
  272.  
  273. CLOSE
  274.   IF cgfx # NIL THEN e.CloseLibrary(cgfx) END;
  275. END CyberGraphics.
  276.  
  277.  
  278.